package com.hx.er.service.admin.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.hx.er.bean.base.CityBean;
import com.hx.er.bean.base.CountryBean;
import com.hx.er.bean.base.DistrictBean;
import com.hx.er.bean.base.StreetBean;
import com.hx.er.bean.detail.CityDetailBean;
import com.hx.er.bean.detail.DistrictDetailBean;
import com.hx.er.bean.detail.StreetDetailBean;
import com.hx.er.dao.ILocationDao;
import com.hx.er.service.admin.IAdminSettingsService;
import com.hx.er.service.base.ErBaseService;

public class AdminSettingsServiceImpl extends ErBaseService implements IAdminSettingsService {

	@Autowired
	private ILocationDao locationDao;

	@Override
	public int deleteCity(CityBean cityBean) {
		return this.locationDao.deleteCity(cityBean);
	}

	@Override
	public int deleteDistrict(DistrictBean districtBean) {
		return this.locationDao.deleteDistrict(districtBean);
	}

	@Override
	public int deleteStreet(StreetBean streetBean) {
		return this.locationDao.deleteStreet(streetBean);
	}

	@Override
	public CityBean getCityById(long cityId) {
		return this.locationDao.getCityById(cityId);
	}

	@Override
	public CityDetailBean getCityDetailById(long cityID) {
		return this.locationDao.getCityDetailById(cityID);
	}

	@Override
	public int getCityDetailCount(Map<String, Object> conditions) {
		return this.locationDao.getCityDetailCount(conditions);
	}

	@Override
	public List<CityDetailBean> getCityDetailList(Map<String, Object> conditions) {
		return this.locationDao.getCityDetailList(conditions);
	}

	@Override
	public CountryBean getCountryById(long countryId) {
		return this.locationDao.getCountryById(countryId);
	}

	@Override
	public List<CountryBean> getCountryList(Map<String, Object> condition) {
		return this.locationDao.getCountryList(condition);
	}

	@Override
	public DistrictDetailBean getDistrictDetailById(long districtId) {
		return this.locationDao.getDistrictDetailById(districtId);
	}

	@Override
	public int getDistrictDetailCount(Map<String, Object> conditions) {
		return this.locationDao.getDistrictDetailCount(conditions);
	}

	@Override
	public List<DistrictDetailBean> getDistrictDetailList(Map<String, Object> conditions) {
		return this.locationDao.getDistrictDetailList(conditions);
	}

	@Override
	public StreetDetailBean getStreetDetailById(long streetId) {
		return this.locationDao.getStreetDetailById(streetId);
	}

	@Override
	public int getStreetDetailCount(Map<String, Object> conditions) {
		return this.locationDao.getStreetDetailCount(conditions);
	}

	@Override
	public List<StreetDetailBean> getStreetDetailList(Map<String, Object> conditions) {
		return this.locationDao.getStreetDetailList(conditions);
	}

	@Override
	public boolean insertCityWithoutId(CityBean cityBean) {
		int count = this.locationDao.checkCityBean(cityBean);
		if (count == 0) {
			this.locationDao.insertCityWithoutId(cityBean);
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean insertDistrictWithoutId(DistrictBean districtBean) {
		int count = this.locationDao.checkDistrictBean(districtBean);
		if (count == 0) {
			this.locationDao.insertDistrictWithoutId(districtBean);
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean insertStreetWithoutId(StreetBean streetBean) {
		int count = this.locationDao.checkStreetBean(streetBean);
		if (count == 0) {
			this.locationDao.insertStreetWithoutId(streetBean);
			return true;
		} else {
			return false;
		}
	}

	@Override
	public int reviveCity(CityBean cityBean) {
		return this.locationDao.reviveCity(cityBean);
	}

	@Override
	public int reviveDistrict(DistrictBean districtBean) {
		return this.locationDao.reviveDistrict(districtBean);
	}

	@Override
	public int reviveStreet(StreetBean streetBean) {
		return this.locationDao.reviveStreet(streetBean);
	}

	@Override
	public int updateCity(CityBean cityBean) {
		return this.locationDao.updateCity(cityBean);
	}

	@Override
	public int updateDistrict(DistrictBean districtBean) {
		return this.locationDao.updateDistrict(districtBean);
	}

	@Override
	public int updateStreet(StreetBean streetBean) {
		return this.locationDao.updateStreet(streetBean);
	}

}
